<?php
namespace app\app\controller\v1;
use app\app\Appbase;

class Activity extends Appbase 
{
	
	/**
	*获取秒杀活动列表
	* /app/v1/activity/getList
	* 需要登录 
	* @is_need_login true
	* @method all
	*/
	public function getList(){
		try {
			$result = model('ActivitySeckill')->getList();
			return $this->ReSucess($result);	
		} catch (\Exception $e) {
			return $this->ReError($e->getMessage());	
		}
	}
	
	
	/**
	*获取某秒杀活动商品列表
	* /app/v1/activity/getGoodsList
	* 需要登录 
	* @is_need_login true
	* @method all
	*/
	public function getGoodsList($id,$pageIndex=1,$pageSize=20){
		if(!$id){
			return $this->ReError('活动id不能为空！');
		}
		try {
			$result = model('ActivitySeckill')->getActivityGoodsList($id,$pageIndex,$pageSize) ?: [];
			return $this->ReSucess($result);	
		} catch (\Exception $e) {
			return $this->ReError($e->getMessage());	
		}
	}
}



